﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Com.Qkds.Erp.WebUi
{
    public partial class Login : System.Web.UI.Page
    {
        


        protected void Page_Load(object sender, EventArgs e)
        {
            Session["Users"] = null;//清除session
           
        }

        protected void btnLogin_Click(object sender, EventArgs e)
        {
            string name = this.txtName.Value;
            string pwd = this.txtPwd.Value;
            SeagullEntities1 db = new SeagullEntities1();
            var user = db.Users.Where(p => p.Name == name && p.Pwd == pwd).FirstOrDefault();
            if (user != null)
            {
                Session["Users"] = name;
                Response.Redirect("Home.aspx");
            }
            else
            {
                this.msg.Text = "登录失败";
            }
        }
    }
}